/*
** my_is_prime.c for my_is_prime in /home/goupil_r//afs/Jour_05
** 
** Made by robin goupil
** Login   <goupil_r@epitech.net>
** 
** Started on  Tue Oct  9 09:38:16 2012 robin goupil
** Last update Mon Oct 22 09:54:36 2012 robin goupil
*/

int     is_it_prime(int nb)
{
  int   i;

  i = 2;
  if (nb <= 1)
    return (0);
  i = 3;
  while (i < nb / 2)
    {
      if ( nb % i == 0)
        return (0);
      i = i + 2;
    }
  return (1);
}

int	my_find_prime_sup(int nb)
{
  if (nb <= 1)
    return (2);
  while (is_it_prime(nb) == 0)
    {
      if (nb % 2 == 0)
	nb = nb + 1;
      else
	nb = nb + 2;
    }
  return (nb);
}
